﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ChurchDiary.DAL.Contract;
using ChurchDiary.DAL.Methods;
using ChurchDiary.TableEntity;
using ChurchDiary.Common;
using System.Globalization;

namespace ChurchDiary.BLL
{
    public class BLL_Website
    {
        #region website
        IWebsite maz = new DAL_Website();
        public string AddMagazhine(EntityMagazine magazhine)
        {
            return maz.InsertMagazhine(magazhine);
        }
        public string UpdateMagazhine(EntityMagazine magazhine)
        {
            return maz.UpdateMagazhine(magazhine);
        }
        public string DeleteMagazhine(Guid magazhineid)
        {
            return maz.DeleteMagazhine(magazhineid);
        }
        public List<EntityMagazine> GetMagazhines()
        {
            return maz.GetMagazhines();
        }
        public EntityMagazine GetMagazhine(Guid magazhineid)
        {
            return maz.GetMagazhine(magazhineid);
        }
        public List<EntityMagazine> GetMagazhinesHome()
        {
            return maz.GetMagazhinesHomePage();
        }
        public string GetMagazhineList(List<EntityMagazine> lstMagazhine)
        {
            string OutString = "";
            int i = 1;
            foreach (EntityMagazine maz in lstMagazhine)
            {
                OutString += "<tr class=\"even pointer\">";
                OutString += "<td class=\"\">" + i + "</td>";
                OutString += "<td class=\" \">" + maz.MagazineHead + "</td>";
                OutString += "<td class=\" \">" + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(maz.MagazineMonth)) + "</td>";
                OutString += "<td class=\" \">" + maz.MagazineYear + "</td>";
                OutString += "<td class=\" \">";
                OutString += "<ul class=\"actionicons\">";
                OutString += "<li><a data-id=" + maz.MagazineId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>";
                //OutString += "<li><a data-id=" + maz.MagazineId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>";
                //OutString += "<li><a href=\"../../Admin/Church/info?ChurchId=" + maz.MagazineId + "\" class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"info\"><i class=\"fa fa-info-circle\"></i></a></li>";
                OutString += "</ul>";
                i += 1;
                OutString += "</td>";
                OutString += "</tr>";
            }
            return OutString;
        }
        public string GetMagazhineStringHome(List<EntityMagazine> Maz)
        {
            string MagStr = "";
            for (int i = 0; i <= Maz.Count - 1; i++)
            {
                MagStr += "<div class=\"item\">";
                string Magazhine = "https://docs.google.com/viewer?url=http://admin.fgpc.in/uploads/Magazine/MagazinePages/" + Maz[i].MagazineFile + "";
                MagStr += "<div class=\"crewman_item\">";
                MagStr += "<div class=\"crewman\">";
                MagStr += "<a href=" + Magazhine + " target=\"_blank\">";
                string link = "http://admin.fgpc.in/uploads/Magazine/Indexpage/" + Maz[i].MagazineStartImage + "";
                MagStr += "<img src=" + link + " alt=\"Dharisanam " + Maz[i].MagazineYear + "\"/>";
                MagStr += "</a>";
                MagStr += "<div class=\"magazineHead\">";
                if (Maz[i].MagazineHead.Length > 30)
                {
                    MagStr += Maz[i].MagazineHead.Substring(0, 30);
                }
                else
                {
                    MagStr += Maz[i].MagazineHead;
                }
                MagStr += "</div>";
                MagStr += "<div class=\"dateandmonth\">" + Maz[i].MagazineYear + "/" + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(Maz[i].MagazineMonth)) + "</div>";
                MagStr += "</div>";
                MagStr += "</div></div>";
            }
            return MagStr;
        }
        public string GetMagazhineString(List<EntityMagazine> Maz)
        {
            string pyear = "";
            string MagStr = "";
            for (int i = 0; i <= Maz.Count - 1; i++)
            {

                if (pyear != Maz[i].MagazineYear)
                {
                    MagStr += "</div>";
                    MagStr += "<div class=\"owl-demo owl-carousel projects_slider\">";
                }
                MagStr += "<div class=\"item\">";
                string Magazhine = "https://docs.google.com/viewer?url=http://admin.fgpc.in/uploads/Magazine/MagazinePages/" + Maz[i].MagazineFile + "";
                MagStr += "<a href=" + Magazhine + " target=\"_blank\">"; 
                MagStr += "<div class=\"magazineDesc\">";
                MagStr += "<div class=\"MagazineImage\">";
                string link = "http://admin.fgpc.in/uploads/Magazine/Indexpage/" + Maz[i].MagazineStartImage + "";
                MagStr += "<img src=" + link + " alt=\"Dharisanam " + Maz[i].MagazineYear + "\">";
                MagStr += "</div>";
                MagStr += "<div class=\"magtitle\">";
                if (Maz[i].MagazineHead.Length > 30)
                {
                    MagStr += Maz[i].MagazineHead.Substring(0, 30);
                }
                else
                {
                    MagStr += Maz[i].MagazineHead;
                }
                MagStr += "</div>";
                MagStr += "<div class=\"YearMonth\">" + Maz[i].MagazineYear + "/" +CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(Maz[i].MagazineMonth)) + "</div>";
                MagStr += "</div>";
                MagStr += " </a></div>";
                pyear = Maz[i].MagazineYear;
            }
            return MagStr;
        }
        public string ChangeCommentStatus(Guid CommentId, int Status)
        {
            return maz.ChangeCommentStatus(CommentId, Status);
        }
        #endregion
        #region Video
        public string GetVideoCategoryTable(List<EntityVideoCategory> VideoCategory)
        {
            StringBuilder sbVideoCategory = new StringBuilder();
            int i = 1;
            foreach (EntityVideoCategory lst in VideoCategory)
            {
                sbVideoCategory.Append("<tr class=\"even pointer\">");
                sbVideoCategory.Append("<td class=\"\">" + i + "</td>");
                sbVideoCategory.Append("<td class=\" \">" + lst.VideoCategoryName + "</td>");
                sbVideoCategory.Append("<td class=\" \">");
                sbVideoCategory.Append("<ul class=\"actionicons\">");
                sbVideoCategory.Append("<li><a data-id=" + lst.VideoCategoryId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbVideoCategory.Append("<li><li><a data-id=" + lst.VideoCategoryId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                sbVideoCategory.Append("<li><a data-id=" + lst.VideoCategoryId + " class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"Upload\"><i class=\"fa fa-cloud-upload\"></i></a></li>");
                sbVideoCategory.Append("</ul>");
                sbVideoCategory.Append("</td>");
                sbVideoCategory.Append("</tr>");
                i += 1;
            }
            return sbVideoCategory.ToString();
        }
        public string GetVideoTable(List<EntityVideos> Videos)
        {
            StringBuilder sbVideoCategory = new StringBuilder();
            int i = 1;
            foreach (EntityVideos lst in Videos)
            {
                sbVideoCategory.Append("<tr class=\"even pointer\">");
                sbVideoCategory.Append("<td class=\"\">" + i + "</td>");
                sbVideoCategory.Append("<td class=\" \">" + lst.VideoCategory.VideoCategoryName + "</td>");
                sbVideoCategory.Append("<td class=\" \">" + lst.VideoTitle + "</td>");
                sbVideoCategory.Append("<td class=\" \">" + lst.VideoUrl + "</td>");
                sbVideoCategory.Append("<td class=\" \">" + lst.VideoDate + "</td>");
                sbVideoCategory.Append("<td class=\" \">");
                sbVideoCategory.Append("<ul class=\"actionicons\">");
                sbVideoCategory.Append("<li><a data-id=" + lst.VideoId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbVideoCategory.Append("<li><li><a data-id=" + lst.VideoId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                sbVideoCategory.Append("<li><a data-id=" + lst.VideoId + " class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"Upload\"><i class=\"fa fa-cloud-upload\"></i></a></li>");
                sbVideoCategory.Append("</ul>");
                sbVideoCategory.Append("</td>");
                sbVideoCategory.Append("</tr>");
                i += 1;
            }
            return sbVideoCategory.ToString();
        }
        #endregion
        #region news
        public string AddNews(EntityNews news)
        {
            return maz.Insertnews(news);
        }
        public string UpdateNews(EntityNews news)
        {
            return maz.UpdateNews(news);
        }
        public string DeleteNews(Guid Newsid)
        {
            return maz.DeleteNews(Newsid);
        }
        public EntityNews GetNews(Guid Newsid)
        {
            return maz.GetNews(Newsid);
        }
        public List<EntityNews> GetNewses()
        {
            return maz.GetNewses();
        }
        public EntityNewsDetails GetNewsDetailsbyLanguageId(Guid NewsId, Guid LanguageId)
        {
            return maz.GetNewsDetailsbyLanguageId(NewsId, LanguageId);
        }
        public string AddNewsDetails(EntityNewsDetails NewsDetails)
        {
            return maz.InsertNewsDetails(NewsDetails);
        }
        public List<EntityNewsWeb> GetNewsWeb()
        {
            return maz.GetNewsforWebsite();
        }
        public List<EntityNewsWeb> GetNewsWebbyLanugage(Guid Language)
        {
            return maz.GetNewsforWebsite(Language);
        }
        public List<EntityNewsWeb> GetNewbyNewsCategory(Guid LanugageId, Guid NewsCategoryId)
        {
            return maz.GetNewbyNewsCategory(LanugageId, NewsCategoryId);
        }
        public string GetNewsWebsite(List<EntityNewsWeb> Newsweb)
        {
            StringBuilder sbNews = new StringBuilder();
            int i = 1;
            foreach (EntityNewsWeb lst in Newsweb)
            {
                string imglink = "http://admin.fgpc.in/uploads/News/"+lst.Image;
                sbNews.Append("<div class=\"blog_post clearfix\" data-animated=\"fadeInUp\">");
                sbNews.Append("<div class=\"blog_post_img\">");
                sbNews.Append("<img src=" + imglink + " alt=\"\" />");
                sbNews.Append("<a class=\"zoom\" href=\"News/Info?NewsId=" + lst.News.NewsId + "&LanguageId=" + lst.Language.LanguageId + "\"></a>");
                sbNews.Append("</div>");
                sbNews.Append("<div class=\"blog_post_descr\">");
                sbNews.Append("<div class=\"blog_post_date\">" + lst.News.NewsDate + "</div>");
                if (lst.NewsDetails.NewsHead.Length > 70)
                {
                    sbNews.Append("<a class=\"blog_post_title\" href=\"News/Info?NewsId=" + lst.News.NewsId + "&LanguageId=" + lst.Language.LanguageId + "\">" + lst.NewsDetails.NewsHead.Substring(0, 70) + "...</a>");
                }
                else
                {
                    sbNews.Append("<a class=\"blog_post_title\" href=\"News/Info?NewsId=" + lst.News.NewsId + "&LanguageId=" + lst.Language.LanguageId + "\">" + lst.NewsDetails.NewsHead + "</a>");
                }
                sbNews.Append("<ul class=\"blog_post_info\">");
                sbNews.Append("<li><a href=\"javascript:void(0);\">" + lst.NewsCategory.NewsCategory + "</a></li>");
                sbNews.Append("<li><a href=\"javascript:void(0);\">" + lst.noofComments + " Comments</a></li>");
                sbNews.Append("</ul>");
                sbNews.Append("<hr>");
                if (lst.NewsDetails.NewsContent.Length > 140)
                {
                    sbNews.Append("<div class=\"blog_post_content\">" + lst.NewsDetails.NewsContent.Substring(0, 140) + "</div>");
                }
                else
                {
                    sbNews.Append("<div class=\"blog_post_content\">" + lst.NewsDetails.NewsContent + "</div>");
                }
                sbNews.Append("<a class=\"read_more_btn\" href=\"News/Info?NewsId=" + lst.News.NewsId + "&LanguageId=" + lst.Language.LanguageId + "\" >Read More</a>");
                sbNews.Append("</div></div><br>");
                i += 1;
            }
            return sbNews.ToString();
        }
        public string GetNewsList(List<EntityNews> news)
        {
            StringBuilder sbNews = new StringBuilder();
            int i = 1;
            foreach (EntityNews lst in news)
            {
                sbNews.Append("<tr class=\"even pointer\">");
                sbNews.Append("<td class=\"\">" + i + "</td>");
                sbNews.Append("<td class=\" \">" + lst.NewsName + "</td>");
                sbNews.Append("<td class=\" \">" + lst.NewsCategory.NewsCategory + "</td>");
                sbNews.Append("<td class=\" \">" + lst.NewsDate + "</td>");
                sbNews.Append("<td class=\" \">" + lst.NewsActiveDate + "</td>");
                sbNews.Append("<td class=\" \">" + lst.NewsExpairyDate + "</td>");
                sbNews.Append("<td class=\" \">");
                sbNews.Append("<ul class=\"actionicons\">");
                sbNews.Append("<li><a data-id=" + lst.NewsId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbNews.Append("<li><a data-id=" + lst.NewsId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                sbNews.Append("<li><a data-id=" + lst.NewsId + " data-toggle=\"tooltip\" class=\"adddetails\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-plus-circle\"></i></a></li>");
                sbNews.Append("<li><a data-id=" + lst.NewsId + " data-toggle=\"tooltip\" class=\"upload\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-cloud-upload\"></i></a></li>");
                sbNews.Append("<li><a href=\"../../Website/News/info?NewsId=" + lst.NewsId + "\" class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"info\"><i class=\"fa fa-info-circle\"></i></a></li>");
                sbNews.Append("</ul>");
                sbNews.Append("</td>");
                sbNews.Append("</tr>");
                i += 1;
            }
            return sbNews.ToString();
        }
        public EntityFullNewsInfo GetNewsInfo(Guid NewsId)
        {
            return maz.GetNewsInfo(NewsId);
        }
        public EntityFullNewsInfo GetNewsInfo(Guid NewsId,Guid LanguageId)
        {
            return maz.GetNewsInfo(NewsId, LanguageId);
        }
        #endregion
        #region News Category
        public List<EntityNewsCategory> GetNewsCategories()
        {
            return maz.GetNewsCategories();
        }
        public EntityNewsCategory GetNewsCategory(Guid NewsCategoryId)
        {
            return maz.GetNewsCategory(NewsCategoryId);
        }
        public string AddNewsCategory(EntityNewsCategory NewsCategory)
        {
            return maz.InsertNewsCategory(NewsCategory);
        }
        public string UpdateNewsCategory(EntityNewsCategory NewsCategory)
        {
            return maz.UpdateNewsCategory(NewsCategory);
        }
        public string DeleteNewsCategory(Guid NewsCategoryid)
        {
            return maz.DeleteNewsCategory(NewsCategoryid);
        }
        public string GetNewsCategoryList(List<EntityNewsCategory> NewsCategory)
        {
            int i = 1;
            string OutString = "";
            foreach (EntityNewsCategory Category in NewsCategory)
            {
                OutString += "<tr class=\"even pointer\">";
                OutString += "<td class=\"\">" + i + "</td>";
                OutString += "<td class=\" \">" + Category.NewsCategory + "</td>";
                OutString += "<td class=\" \"><ul class=\"actionicons\">";
                OutString += "<li><a data-id=" + Category.NewsCategoryId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>";
                OutString += "<li><a data-id=" + Category.NewsCategoryId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>";
                OutString += "</ul></td>";
                i += 1;
                OutString += "</tr>";
            }
            return OutString;
        }
        public string GetNewsCategoryOption(List<EntityNewsCategory> NewsCategory)
        {
            string OutString = "";
            OutString += "<option value=\"\">Please Select</option>";
            foreach (EntityNewsCategory Category in NewsCategory)
            {
                OutString += "<option value=" + Category.NewsCategoryId + ">" + Category.NewsCategory + "</option>";
            }
            return OutString;
        }
        public string GetNewsCategoryWebsite(List<EntityNewsCategory> NewsCategory)
        {
            string OutString = "";
            OutString += "<ul>";
            foreach (EntityNewsCategory Category in NewsCategory)
            {
                OutString += "<li><a class=\"clsnewcategory\" data-id=" + Category.NewsCategoryId + ">" + Category.NewsCategory + "</a></li>";
            }
            OutString += "</ul>";
            return OutString;
        }
        #endregion
        #region Events Category
        public string AddEventCategory(EntityEventCategory EventCategory)
        {
            return maz.InsertEventCategory(EventCategory);
        }
        public string UpdateEventCategory(EntityEventCategory EventCategory)
        {
            return maz.UpdateEventCategory(EventCategory);
        }
        public string DeleteEventCategory(Guid EventCategoryid)
        {
            return maz.DeleteEventCategory(EventCategoryid);
        }
        #endregion
        #region Video Category
        public string AddVideoCategory(EntityVideoCategory VideoCategory)
        {
            return maz.InsertVideoCategory(VideoCategory);
        }
        public string UpdateVideoCategory(EntityVideoCategory VideoCategory)
        {
            return maz.UpdateVideoCategory(VideoCategory);
        }
        public string DeleteVideoCategory(Guid VideoCategoryid)
        {
            return maz.DeleteVideoCategory(VideoCategoryid);
        }
        #endregion
        #region Photo Category
        public string AddPhotoCategory(EntityPhotoCategory PhotoCategory)
        {
            IWebsite Web = new DAL_Website();
            return Web.InsertPhotoCategory(PhotoCategory);
        }
        public string UpdatePhotoCategory(EntityPhotoCategory PhotoCategory)
        {
            IWebsite Web = new DAL_Website();
            return Web.UpdatePhotoCategory(PhotoCategory);
        }
        public string DeletePhotoCategory(Guid PhotoCategoryid)
        {
            IWebsite Web = new DAL_Website();
            return Web.DeletePhotoCategory(PhotoCategoryid);
        }
        #endregion
        #region photos
        public string AddPhoto(EntityPhoto Photo)
        {
            IWebsite Web = new DAL_Website();
            return Web.InsertPhoto(Photo);
        }
        public string UpdatePhoto(EntityPhoto Photo)
        {
            IWebsite Web = new DAL_Website();
            return Web.UpdatePhoto(Photo);
        }
        public string DeletePhoto(Guid Photoid)
        {
            IWebsite Web = new DAL_Website();
            return Web.DeletePhoto(Photoid);
        }
        #endregion
        #region Event
        public string AddEvents(EntityEvents Events)
        {
            return maz.InsertEvents(Events);
        }
        public string UpdateEvents(EntityEvents Events)
        {
            return maz.UpdateEvents(Events);
        }
        public string DeleteEvents(Guid EventId)
        {
            return maz.DeleteEvents(EventId);
        }
        public List<EntityEvents> GetEvents()
        {
            return maz.GetEvents();
        }
        public EntityEvents GetEvent(Guid EventId)
        {
            return maz.GetEvent(EventId);
        }
        public string GetEventTable(List<EntityEvents> Events)
        {
            StringBuilder sbEvents = new StringBuilder();
            int i = 1;
            foreach (EntityEvents lst in Events)
            {
                sbEvents.Append("<tr class=\"even pointer\">");
                sbEvents.Append("<td class=\"\">" + i + "</td>");
                sbEvents.Append("<td class=\" \">" + lst.EventCategory.EventCategoryName + "</td>");
                if (lst.EventHead.Length > 40)
                {
                    sbEvents.Append("<td class=\" \">" + lst.EventHead.Substring(0, 40) + "...</td>");
                }
                else
                {
                    sbEvents.Append("<td class=\" \">" + lst.EventHead + "</td>");
                }
                if (lst.EventContent.Length > 40)
                {
                    sbEvents.Append("<td class=\" \">" + lst.EventContent.Substring(0, 40) + "...</td>");
                }
                else
                {
                    sbEvents.Append("<td class=\" \">" + lst.EventContent + "</td>");
                }
                sbEvents.Append("<td class=\" \">" + lst.Status.StatusTypeName + "</td>");
                sbEvents.Append("<td class=\" \">");
                sbEvents.Append("<ul class=\"actionicons\">");
                sbEvents.Append("<li><a data-id=" + lst.EventId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbEvents.Append("<li><a data-id=" + lst.EventId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                sbEvents.Append("<li><a data-id=" + lst.EventId + " data-toggle=\"tooltip\" class=\"view confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"View\"><i class=\"fa fa-eye\"></i></a></li>");
                sbEvents.Append("<li><a data-id=" + lst.EventId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-th-list\"></i></a></li>");
                sbEvents.Append("</ul>");
                sbEvents.Append("</td>");
                sbEvents.Append("</tr>");
                i += 1;
            }
            return sbEvents.ToString();
        }
        #endregion
        #region Subcribers
        public string AddSubcriber(EntitySubcriber Subcriber)
        {
            return maz.InsertSubcriber(Subcriber);
        }
        public string UpdateSubcriber(EntitySubcriber Subcriber)
        {
            return maz.UpdateSubcriber(Subcriber);
        }
        public string DeleteSubcriber(Guid SubcriberId)
        {
            return maz.DeleteSubcriber(SubcriberId);
        }
        public List<EntitySubcriber> GetSubcribers()
        {
            return maz.GetSubcribers();
        }
        public EntitySubcriber GetSubcriber(Guid SubcriberId)
        {
            return maz.GetSubcriber(SubcriberId);
        }
        public void CreateSubcriberMail(EntityNewsletter Newsletter)
        {
            List<EntitySubcriber> Subcribers = new List<EntitySubcriber>();
            Subcribers = GetSubcribers();
            foreach (EntitySubcriber Subcriber in Subcribers)
            {
                EntityEmail Email = new EntityEmail();
                Email.EmailFrom = "dotreplay@fgpc.in";
                Email.EmailToAddress = Subcriber.SubcriberEmail;
                Email.EmailBcc = Subcriber.SubcriberEmail;
                Email.EmailCC = "";
                Email.EmailSubject = Newsletter.NewsLetterSubject;
                Email.EmailContent = Newsletter.NewsLetterContent;
                Email.EmaiStatus = 0;
                Email.EmailType = EMAILTYPE.NEWSLETTER.ToString();
                Email.EmailCreatedBy = Current.Userid;
                Email.EmailCreatedOn = DateTime.UtcNow;
                Email.EmailSourceId = Newsletter.NewsLetterId;
                new BLL_Common().InsertEmail(Email);
            }
        }
        #endregion
        #region Video
        public List<EntityVideoCategory> GetVideoCategory()
        {
            return maz.GetVideoCategory();
        }
        public string VideoCatagoryWebsite(List<EntityVideoCategory> videos)
        {
            string OutString = "<li><a data-id='0'>All</a></li>";
            foreach (EntityVideoCategory vid in videos)
            {
                OutString += "<li><a data-id=" + vid.VideoCategoryId + ">" + vid.VideoCategoryName + "</a></li>";
            }
            return OutString;
        }
        public string VideoCatagoryOption(List<EntityVideoCategory> videos)
        {
            string OutString = "<option value=\"\">Select</option>";
            foreach (EntityVideoCategory vid in videos)
            {
                OutString += "<option value=" + vid.VideoCategoryId + ">" + vid.VideoCategoryName + "</option>";
            }
            return OutString;
        }
        public EntityVideoCategory GetVideoCategory(Guid VideoCategoryId)
        {
            return maz.GetVideoCategory(VideoCategoryId);
        }
        public string GetVideoCategoryList(List<EntityVideoCategory> EventCategory)
        {
            int i = 1;
            string OutString = "";
            foreach (EntityVideoCategory Category in EventCategory)
            {
                OutString += "<tr class=\"even pointer\">";
                OutString += "<td class=\"\">" + i + "</td>";
                OutString += "<td class=\" \">" + Category.VideoCategoryName + "</td>";
                OutString += "<td class=\" \"><ul class=\"actionicons\">";
                OutString += "<li><a data-id=" + Category.VideoCategoryId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>";
                OutString += "<li><a data-id=" + Category.VideoCategoryId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>";
                OutString += "</ul></td>";
                i += 1;
                OutString += "</tr>";
            }
            return OutString;
        }
        public string GetVideoCategoryFilterOption(List<EntityVideoCategory> VideoCategory)
        {
            StringBuilder sbDepartments = new StringBuilder();
            sbDepartments.Append("<li role=\"presentation\" data-id=\"0\"><a role=\"menuitem\" tabindex=\"-1\">All</a></li>");
            foreach (EntityVideoCategory lst in VideoCategory)
            {
                sbDepartments.Append("<li role=\"presentation\" data-id=" + lst.VideoCategoryId + "><a role=\"menuitem\" tabindex=\"-1\">" + lst.VideoCategoryName + "</a></li>");
            }
            return sbDepartments.ToString();
        }
        public string AddVideo(EntityVideos Videos)
        {
            return maz.InsertVideo(Videos);
        }
        public string UpdateVideo(EntityVideos video)
        {
            return maz.UpdateVideo(video);
        }
        public string DeleteVideo(string videoid)
        {
            return maz.DeleteVideo(videoid);
        }
        public EntityVideos GetVideo(Guid videoid)
        {
            return maz.GetVideo(videoid);
        }
        public List<EntityVideos> GetVideo()
        {
            return maz.GetVideo();
        }
        public List<EntityVideos> GetVideoByCategory(Guid VideoCategoryId)
        {
            return maz.GetVideoByCategory(VideoCategoryId);
        }
        public string VideoList(List<EntityVideos> Videos)
        {
            string OutString = "";
            int i = 1;
            foreach (EntityVideos vid in Videos)
            {
                OutString += "<tr class=\"even pointer\">";
                OutString += "<td class=\"\">" + i + "</td>";
                OutString += "<td class=\" \">" + vid.VideoCategory.VideoCategoryName + "</td>";
                OutString += "<td class=\" \">" + vid.VideoTitle + "</td>";
                OutString += "<td class=\" \">" + vid.VideoUrl + "</td>";
                OutString += "<td class=\" \">" + vid.VideoDate + "</td>";
                OutString += "<td class=\" \">" + vid.VideoDesc + "</td>";
                OutString += "<td class=\" \"> <ul class=\"actionicons\"><li><a data-id=" + vid.VideoId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>";
                OutString += "<li><a data-id=" + vid.VideoId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li> <li><a data-id=" + vid.VideoId + " class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"View\"><i class=\"fa fa-eye\"></i></a></li></ul></td>";
                i += 1;
                OutString += "</tr>";
            }
            return OutString;
        }
        public string VideoWebsiteList(List<EntityVideos> Videos)
        {
            string OutString = "";
            foreach (EntityVideos vid in Videos)
            {
                string href = "http://img.youtube.com/vi/" + vid.VideoUrl + "/hqdefault.jpg";
                OutString += "<div class=\"videolistcol\" data-url=" + vid.VideoUrl + " data-desc=" + vid.VideoDesc + " data-title=" + vid.VideoTitle + " data-vdate=" + vid.VideoDate + ">";
                OutString += "<a href=\"javascript:\">";    
                OutString += "<img src=" + href + " alt=" + vid.VideoTitle + ">";
                OutString += "<div class=\"videotitle\">" + vid.VideoTitle + "</div>";
                OutString += "<div class=\"videoDate\">" + vid.VideoDate + "</div>";
                OutString += "</a></div>";
            }
            return OutString;
        }
        #endregion
        #region Message
        public string InsertMessage(EntityMessage Message)
        {
            return maz.InsertMessage(Message);
        }
        public List<EntityMessage> GetMessages()
        {
            return maz.GetMessage();
        }
        #endregion
        #region Banner
        public List<EntityBanner> GetBanners()
        {
            return maz.GetBanner();
        }
        public EntityBanner GetBanner(Guid BannerId)
        {
            return maz.GetBanner(BannerId);
        }
        public string AddBanner(EntityBanner Banner)
        {
            return maz.InsertBanner(Banner);
        }
        public string UpdateBanner(EntityBanner Banner)
        {
            return maz.UpdateBanner(Banner);
        }
        public string DeleteBanner(Guid BannerId)
        {
            return maz.DeleteBanner(BannerId);
        }
        #endregion
        #region Article
        public string InsertArticle(EntityArticle Article)
        {
            IWebsite Web = new DAL_Website();
            return Web.InsertArticle(Article);
        }
        public string UpdateArticle(EntityArticle Article)
        {
            IWebsite Web = new DAL_Website();
            return Web.UpdateArticle(Article);
        }
        public string DeleteArticle(Guid ArticleId)
        {
            IWebsite Web = new DAL_Website();
            return Web.DeleteArticle(ArticleId);
        }
        public List<EntityArticle> GetArticle()
        {
            IWebsite Web = new DAL_Website();
            return Web.GetArticle();
        }
        public EntityArticle GetArticle(Guid ArticleId)
        {
            IWebsite Web = new DAL_Website();
            return Web.GetArticle(ArticleId);
        }
        #endregion
        #region Newsletter
        public string InsertNewsletter(EntityNewsletter Newsletter)
        {
            IWebsite Web = new DAL_Website();
            return Web.InsertNewsletter(Newsletter);;
        }
        public string UpdateNewsletter(EntityNewsletter Newsletter)
        {
            IWebsite Web = new DAL_Website();
            return Web.UpdateNewsletter(Newsletter);
        }
        public string DeleteNewsletter(Guid NewsletterId)
        {
            IWebsite Web = new DAL_Website();
            return Web.DeleteNewsletter(NewsletterId);
        }
        public List<EntityNewsletter> GetNewsletters()
        {
            IWebsite Web = new DAL_Website();
            return Web.GetNewsletters();
        }
        public EntityNewsletter GetNewsletter(Guid NewsletterId)
        {
            IWebsite Web = new DAL_Website();
            return Web.GetNewsletter(NewsletterId);
        }
        public string ApproveRejectNewsletter(Guid NewsletterId, int Status)
        {
            IWebsite Web = new DAL_Website();
            return Web.ApproveRejectNewsletter(NewsletterId, Status);
        }
        public string SendNewsletter(Guid NewsletterId)
        {
            IWebsite Web = new DAL_Website();
            string Result = Web.SendNewsletter(NewsletterId);
            if (Result == "ISUS")
            {
                EntityNewsletter Newsletter = new EntityNewsletter();
                Newsletter = GetNewsletter(NewsletterId);
                CreateSubcriberMail(Newsletter);
            }
            return Result;
        }
        #endregion
        #region AlbumSongs
        public string InsertSong(EntitySongs Song)
        {
            IWebsite Web = new DAL_Website();
            return Web.InsertSong(Song);
        }
        public string UpdateSong(EntitySongs Song)
        {
            IWebsite Web = new DAL_Website();
            return Web.UpdateSong(Song);
        }
        public string DeleteSong(Guid SongId)
        {
            IWebsite Web = new DAL_Website();
            return Web.DeleteSong(SongId);
        }
        public List<EntitySongs> GetSongs()
        {
            IWebsite Web = new DAL_Website();
            return Web.GetSongs();
        }
        public EntitySongs GetSong(Guid SongsId)
        {
            IWebsite Web = new DAL_Website();
            return Web.GetSongs(SongsId);
        }
        public List<EntitySongs> GetSongsByAlbums(Guid AlbumId)
        {
            IWebsite Web = new DAL_Website();
            return Web.GetSongsByAlbums(AlbumId);
        }
        #endregion
        #region Album
        public string InsertAlbum(EntityAlbums Album)
        {
            IWebsite Web = new DAL_Website();
            return Web.InsertAlbum(Album);
        }
        public string UpdateAlbum(EntityAlbums Album)
        {
            IWebsite Web = new DAL_Website();
            return Web.UpdateAlbum(Album);
        }
        public string DeleteAlbum(Guid AlbumId)
        {
            IWebsite Web = new DAL_Website();
            return Web.DeleteAlbum(AlbumId);
        }
        public List<EntityAlbums> GetAlbums(int PageNo, string SearchKey)
        {
            IWebsite Web = new DAL_Website();
            return Web.GetAlbums(PageNo,SearchKey);
        }
        public EntityAlbums GetAlbum(Guid AlbumId)
        {
            IWebsite Web = new DAL_Website();
            return Web.GetAlbum(AlbumId);
        }
        #endregion
    }

}
